<!--  -->
<template>
  <div>
    <input type="button" value="-" @click="minus"> <input type="text" v-model="number"><input type="button" value="+"
      @click="add">
  </div>
</template>

<script>
  export default {
    props: {

    },
    data() {
      return {
        number: 1
      };
    },
    computed: {

    },
    created() {

    },
    mounted() {

    },
    watch: {

    },
    methods: {
      add() {
        var num = parseInt(this.number)
        num += 30;
        this.number = num
        var jsontext = '{ "hiredate": "2008-01-01T12:00:00Z", "birthdate": "2008-12-25T12:00:00Z" }';
        var dates = JSON.parse(jsontext, this.dateReviver);
        console.log(dates)
      },
      minus() {
        if (this.number >= 30) {
          this.number -= 30;
        }
      },
      dateReviver(key, value) {
        var a;
        if (typeof value === 'string') {
          a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
          if (a) {
            return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
              +a[5], +a[6]));
          }
        }
        return value;
      }
    },
    components: {

    },
  };

</script>

<style scoped>

</style>
